package com.ruoyi.loan.service.impl;

import com.ruoyi.loan.service.FileService;
import com.ruoyi.loan.utils.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

/**
 * Author: 廖振辉
 * Date: 2022/4/18
 * Description:
 */
@Service
public class FileServiceImpl implements FileService {

    @Autowired
    private FileUtils fileUtils;

    @Override
    public String uploadFile(MultipartFile file, String baseName) {
        if (!FileUtils.checkFileSize(file)) {
            throw new RuntimeException("文件过大");
        }
        return FileUtils.upLoadFile(file, baseName);
    }
}
